package part12;

/**
 * @author wcj
 * @Date 2021/5/21 16:36
 * @Version 1.0
 */
public class Part1211 {

    public void f() throws VeryImportantException {
        throw new VeryImportantException();
    }

    public void dispose() throws HohumException {
        throw new HohumException();
    }

    /**
     * 异常丢失，例如在finally语句中进行return
     *
     * @param args
     */
    public static void main(String[] args) {
        try {
            Part1211 part1211 = new Part1211();
            try {
                part1211.f();
            } finally {
                part1211.dispose();
            }
        } catch (Exception e) {
            System.out.println(e);
        }

        try {
            throw new RuntimeException();
        } finally {
            return;
        }
    }

    class VeryImportantException extends Exception {
        @Override
        public String toString() {
            return "a very important exception";
        }
    }
}

class HohumException extends Exception {
    @Override
    public String toString() {
        return "a trivial exception";
    }
}


